package au.com.langdale.gwt.client.remote;


/**
 * The idea of this class is to abstract associations between
 * model objects.<p>  
 * 
 * The Hibernate lazy loading approach is not applicable
 * in the browser.  Moreover, we want to provide a list of 
 * candidates in addition to the currently associated object.<p>   
 * 
 * TODO: RemoteAssociation is under construction at this point.<p>
 * 
 * @author adv
 *
 */
abstract public class RemoteAssociation extends RemoteList {
	private Object model;
	private Object associate;

	public Object getAssociate() {
		return associate;
	}
	
	public void setAssociate(Object associate) {
		this.associate = associate;
		link(model, associate);
	}
	
	public Object getModel() {
		return model;
	}
	
	public void setModel(Object model) {
		this.model = model;
	}

	protected void pull(int requestFirst, int requestQuota) {
		pull(model, requestFirst, requestQuota);
	}

	abstract protected void pull(Object model, int requestFirst, int requestQuota);
	
	abstract protected void link(Object model, Object associate);
}
